#!/bin/bash

#  Copyright 2015-2016 bill-auger <https://github.com/bill-auger/av-caster/issues>
#
#  This file is part of the AvCaster program.
#
#  AvCaster is free software: you can redistribute it and/or modify
#  it under the terms of the GNU General Public License version 3
#  as published by the Free Software Foundation.
#
#  AvCaster is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with AvCaster.  If not, see <http://www.gnu.org/licenses/>.


echo "running cppcheck --enable=all on ./Source/ with filters"

# supress warnings for 'unused' event handlers
#     so that we can exclude the JUCE library from cppcheck
cppcheck --enable=all --template=gcc --force --quiet -i Source/Trace Source/ 2>        >(
  grep -v "Cppcheck cannot find all the include files"                                  |
  grep -v "The function 'initialise' is never used."                                    |
  grep -v "The function 'anotherInstanceStarted' is never used."                        |
  grep -v "The function 'moreThanOneInstanceAllowed' is never used."                    |
  grep -v "The function 'userTriedToCloseWindow' is never used."                        |
  grep -v "The function 'closeButtonPressed' is never used."                            |
  grep -v "The function 'timerCallback' is never used."                                 |
  grep -v "The function 'getApplicationName' is never used."                            |
  grep -v "The function 'getApplicationVersion' is never used."                         |
  grep -v "The function 'resized' is never used."                                       |
  grep -v "The function 'paint' is never used."                                         |
  grep -v "The function 'run' is never used."                                           |
  grep -v "The function 'broughtToFront' is never used."                                |
  grep -v "The function 'mouseDown' is never used."                                     |
  grep -v "The function 'buttonClicked' is never used."                                 |
  grep -v "The function 'comboBoxChanged' is never used."                               |
  grep -v "The function 'sliderValueChanged' is never used."                            |
  grep -v "The function 'textEditorFocusLost' is never used."                           |
  grep -v "The function 'valueTreePropertyChanged' is never used."                      |
  grep -v "The function 'textEditorReturnKeyPressed' is never used."                    |
  grep -v "The function 'valueTreeChildAdded' is never used."                           |
  grep -v "The function 'valueTreeChildRemoved' is never used."                         |
  grep -v "The function 'textEditorTextChanged' is never used."                         |
  grep -v "has a constructor with 1 argument that is not explicit."                     )
